home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK2.toast / Development Kits (Disc 2) / OpenDoc Development Framework / ODF-Interest Archive / May 96 / Menu Questions < prev    next >
Encoding:
Internet Message Format  |  1996-12-03  |  2.6 KB  |  [TEXT/ttxt]

  1. Subject:     Menu Questions
  2. Sent:        5/11/96 10:22 AM
  3. Received:    5/11/96 12:37 PM
  4. From:        Nolan Larsen, nlarsen@dharbor.com
  5. Reply-To:    ODF-Interest@CILabs.ORG
  6. To:          OpenDoc Development Framework Discussion List, ODF-Interest@CILabs.
  7.  
  8. I came across a couple of bugs in the file FWPullDM.cpp of ODF d11. The
  9. FW_CPullDownMenu::EnableAll method uses the following code:
  10.  
  11.         (*fPlatformMenu)->enableFlags &= 0xFFFFFFFF;
  12.  
  13. Anding everything with 1 does nothing to enableFlags. In fact, the compiler
  14. optimizes the code out so nothing is generated to enable the menus. The
  15. following will produce the desired effect:
  16.  
  17.         (*fPlatformMenu)->enableFlags = 0xFFFFFFFF;
  18.  
  19.  
  20. The FW_CPullDownMenu::DisableAll has a slightly different problem. It uses
  21. the following line of code to disable all of the menu items:
  22.         (*fPlatformMenu)->enableFlags &= 0x00000001;
  23. This code does disable all of the items but does not disable the menu
  24. itself. According to the HI guidelines, if all menu items are disabled the
  25. menu itself should also be disabled. The following is more in keeping with
  26. the guidelines:
  27.  
  28.         (*fPlatformMenu)->enableFlags = 0x00000000;
  29.  
  30. BTW, What is the best way to handle a font menu? I am using the follwing
  31. code to create the font menu:
  32.  
  33.         fFontPullDownMenu = new FW_CPullDownMenu(ev, resFile, kMenuStrings,
  34. kFontMenuStr);
  35.  
  36.         FW_CFontIterator myFonts;
  37.         FW_CIntlString  myString = myFonts.First();
  38.         while (myString != "")
  39.         {
  40.                 fFontPullDownMenu->AppendTextItem(ev, myString, cFontName);
  41.                 myString = myFonts.Next();
  42.         }
  43.  
  44.         menuBar->AdoptMenuLast(ev, fFontPullDownMenu);
  45.  
  46. This seems to work, but seems terribly inefficient to create a dummy font
  47. menu, do the AppendResMenu, and then copy the fonts over one by one into my
  48. menu. Why can't I just ask ODF to fill my menu with fonts?
  49.  
  50. Once I have the menu created, I want to use the menu item text to tell me
  51. which font to set when one is chosen from the menu. How can I get the item
  52. text of the selected item in my part's DoMenu method?
  53.  
  54. While on the subject of menus. When building a Style menu with Bold,
  55. Italics, etc. in it, what is the best way to set the appropriate attributes
  56. for each item. This is a similar issue for the Size menu which should use
  57. Outline for installed fonts.
  58.  
  59. Thanks,
  60. Nolan
  61.  
  62. =========================================================================
  63. Nolan Larsen                                         Digital Harbor
  64. nlarsen@dharbor.com                             "Pier-to-Pier Computing"
  65. =========================================================================
  66.  
  67.